package telex;

import java.lang.reflect.*;

import com.aliasi.sentences.MedlineSentenceModel;
import com.aliasi.sentences.SentenceChunker;
import com.aliasi.sentences.SentenceModel;
import com.aliasi.tokenizer.IndoEuropeanTokenizerFactory;
import com.aliasi.tokenizer.TokenizerFactory;

public class OpenNLPProvider {
	
	public static SentenceChunker createSentenceDetector() {
		try {
				TokenizerFactory TOKENIZER_FACTORY = createTokenizer();
			    SentenceModel SENTENCE_MODEL  = new MedlineSentenceModel();
				return new SentenceChunker(TOKENIZER_FACTORY,SENTENCE_MODEL);
		} catch (Exception e) {
			System.err.println("Error instantiating sentence detector: " + e);
			return null;
		}
	}

	public static TokenizerFactory createTokenizer() {
		try {
			TokenizerFactory TOKENIZER_FACTORY = IndoEuropeanTokenizerFactory.INSTANCE;
			return TOKENIZER_FACTORY;
		} catch (Exception e) {
			System.err.println("Error instantiating sentence detector: " + e);
			return null;
		}
	}

	public static void setSentenceDetectorModelPath(String aPath) {
		mSentenceDetectorModelPath = aPath;
	}

	public static void setTokenizerModelPath(String aPath) {
		mTokenizerModelPath = aPath;
	}

	private static String mSentenceDetectorModelPath;
	private static String mTokenizerModelPath;

}